package edu.chen.service.impl;

import edu.chen.dao.BookDao;
import edu.chen.entity.Book;
import edu.chen.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookDao bookDao;

    @Transactional
    public Book getById(int id){
            return bookDao.queryById(id);
    }

    @Transactional
    public List<Book> list(){
        return bookDao.query(-1,0);
    }
}
